package org.jet.emall.prod;


import org.jet.emall.prod.dto.CustomerAddrDTO;
import org.jet.emall.prod.dto.CustomerDetailsDTO;
import org.jet.emall.prod.dto.NewCustomerDTO;
import org.jet.emall.prod.model.NewCustomerModel;
import org.jet.emall.prod.model.UpdateCustomerAddrModel;
import org.jet.emall.prod.vo.CustomerAddrVO;
import org.jet.emall.prod.vo.CustomerDetailsVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @author xiaozai
 * @version 1.0
 * @date 2020-04-23 11:59
 */
@Mapper
public interface CustomerVoTransfer {
    CustomerVoTransfer INSTANCE = Mappers.getMapper(CustomerVoTransfer.class);


    NewCustomerDTO toDto(NewCustomerModel customer);

    CustomerDetailsVO toVo(CustomerDetailsDTO dto);

    /**
     *
     * @param vo
     * @return
     */
    CustomerAddrDTO toAddrDto(CustomerAddrVO vo);
    /**
     *
     * @param model
     * @return
     */
    @Mappings({
            @Mapping(target = "modifiedTime",ignore = true),
            @Mapping(target = "isDefault",ignore = true)
    })
    CustomerAddrDTO toAddrDto(UpdateCustomerAddrModel model);
}
